import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FloorForm, FloorQuery, FloorVO } from '@/api/system/floor/types';

/**
 * 查询楼栋管理列表
 * @param query
 * @returns {*}
 */

export const listFloor = (query?: FloorQuery): AxiosPromise<FloorVO[]> => {
  return request({
    url: '/system/floor/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询楼栋管理详细
 * @param floorId
 */
export const getFloor = (floorId: string | number): AxiosPromise<FloorVO> => {
  return request({
    url: '/system/floor/' + floorId,
    method: 'get'
  });
};

/**
 * 新增楼栋管理
 * @param data
 */
export const addFloor = (data: FloorForm) => {
  return request({
    url: '/system/floor',
    method: 'post',
    data: data
  });
};

/**
 * 修改楼栋管理
 * @param data
 */
export const updateFloor = (data: FloorForm) => {
  return request({
    url: '/system/floor',
    method: 'put',
    data: data
  });
};

/**
 * 删除楼栋管理
 * @param floorId
 */
export const delFloor = (floorId: string | number | Array<string | number>) => {
  return request({
    url: '/system/floor/' + floorId,
    method: 'delete'
  });
};
